C----------------------------------------------------------------------C
C     	
C     A 30-species reduced mechanism for DME/air
C
C     Developed by:
C
C       Tianfeng Lu & Zhaoyu Luo
C       Department of Mechanical Engineering
C       University of Connecticut
C       191 Audotorium Road U-3139
C       Storrs, CT 06269
C
C       Email: tlu@engr.uconn.edu
C
C     Citation: 
C       Bhagatwala A., Luo Z., Lu T.F., Shen H., Sutton J.A., Chen J.H., 
C       "Numerical and experimental investigation of turbulent 
C        DME jet flames," Proc. Combust. Inst., 
C        DOI: 10.1016/j.proci.2014.05.147, 2014.
C
C----------------------------------------------------------------------
C
      SUBROUTINE MCADIF (P, T, XX, RMCWRK, D)
C
      IMPLICIT DOUBLE PRECISION (A-H, O-Z), INTEGER (I-N)
C
      DIMENSION XX(*), D(*), RMCWRK(*)
      DIMENSION X(30), Y(30), WT(30), XXWT(30)
      DIMENSION DG(14,14), XG(14), QG(14)
      DATA WT/1.00797, 2.01594, 15.0351, 15.9994, 
     *  16.043, 17.0074, 18.0153, 26.0382, 
     *  28.0106, 28.0542, 29.0622, 30.0265, 
     *  30.0701, 31.0345, 31.9988, 33.0068, 
     *  34.0147, 44.01, 44.0536, 46.0259, 
     *  46.0695, 59.045, 60.053, 62.0689, 
     *  75.0444, 75.0444, 77.0604, 92.0518, 
     *  109.059, 28.0134/
C
      SUMXW = ZERO
      SUMXX = ZERO
      DO K = 1, 30
         X(K) = MAX(XX(K), 1.0D-50)
         SUMXX = SUMXX + X(K)
         XXWT(K) = X(K)*WT(K)
         SUMXW = SUMXW + XXWT(K)
      ENDDO
      DO K = 1, 30
         X(K) = X(K)/SUMXX
         Y(K) = XXWT(K)/SUMXW
      ENDDO
C
      ZERO = 0.0D0
      ALOGT = LOG(T)
      PA = P/1.01325D+06
C
      XG(  1) = +X(  1) 
      XG(  2) = +X(  2) 
      XG(  3) = +X(  3) +X(  5) 
      XG(  4) = +X(  4) +X(  6) 
      XG(  5) = +X(  7) 
      XG(  6) = +X(  8) 
      XG(  7) = +X(  9) +X( 15) +X( 16) +X( 17) +X( 30) 
      XG(  8) = +X( 10) 
      XG(  9) = +X( 11) +X( 13) 
      XG( 10) = +X( 12) +X( 14) 
      XG( 11) = +X( 18) 
      XG( 12) = +X( 19) 
      XG( 13) = +X( 20) +X( 21) 
      XG( 14) = +X( 22) +X( 23) +X( 24) +X( 25) +X( 26) 
     *          +X( 27) +X( 28) +X( 29) 
C
      DG(1,1)=EXP(-15.1908 + ALOGT*(4.38431
     1           +ALOGT*(-0.355755+ALOGT*0.0154801)))
      DG(2,1)=EXP(-12.0191 + ALOGT*(3.03314
     1           +ALOGT*(-0.186015+ALOGT*0.00836163)))
      DG(2,2)=EXP(-10.3183 + ALOGT*(2.19241
     1           +ALOGT*(-0.0753904+ALOGT*0.00351123)))
      DG(3,1)=EXP(-18.0164 + ALOGT*(5.09009
     1           +ALOGT*(-0.445755+ALOGT*0.0192914)))
      DG(3,2)=EXP(-13.5842 + ALOGT*(3.23985
     1           +ALOGT*(-0.21505+ALOGT*0.00971523)))
      DG(3,3)=EXP(-17.7299 + ALOGT*(4.3677
     1           +ALOGT*(-0.353728+ALOGT*0.0153976)))
      DG(4,1)=EXP(-15.3129 + ALOGT*(4.27089
     1           +ALOGT*(-0.348233+ALOGT*0.015451)))
      DG(4,2)=EXP(-10.9337 + ALOGT*(2.30613
     1           +ALOGT*(-0.0873643+ALOGT*0.00389753)))
      DG(4,3)=EXP(-15.6169 + ALOGT*(3.70389
     1           +ALOGT*(-0.271241+ALOGT*0.0119728)))
      DG(4,4)=EXP(-13.5685 + ALOGT*(3.06218
     1           +ALOGT*(-0.188969+ALOGT*0.00845414)))
      DG(5,1)=EXP(-16.5132 + ALOGT*(4.2207
     1           +ALOGT*(-0.282595+ALOGT*0.0101807)))
      DG(5,2)=EXP(-18.185 + ALOGT*(5.04362
     1           +ALOGT*(-0.437707+ALOGT*0.0188764)))
      DG(5,3)=EXP(-20.4245 + ALOGT*(5.22244
     1           +ALOGT*(-0.432499+ALOGT*0.0175196)))
      DG(5,4)=EXP(-19.0651 + ALOGT*(4.98906
     1           +ALOGT*(-0.419283+ALOGT*0.0176187)))
      DG(5,5)=EXP(-11.8024 + ALOGT*(0.888791
     1           +ALOGT*(0.24617+ALOGT*-0.0160706)))
      DG(6,1)=EXP(-16.9942 + ALOGT*(4.44711
     1           +ALOGT*(-0.332355+ALOGT*0.0131017)))
      DG(6,2)=EXP(-15.8605 + ALOGT*(4.11635
     1           +ALOGT*(-0.329941+ALOGT*0.0147372)))
      DG(6,3)=EXP(-19.3822 + ALOGT*(4.86064
     1           +ALOGT*(-0.406069+ALOGT*0.0171827)))
      DG(6,4)=EXP(-17.8467 + ALOGT*(4.48333
     1           +ALOGT*(-0.36843+ALOGT*0.0160195)))
      DG(6,5)=EXP(-20.0093 + ALOGT*(4.76919
     1           +ALOGT*(-0.346757+ALOGT*0.0127672)))
      DG(6,6)=EXP(-20.8228 + ALOGT*(5.22122
     1           +ALOGT*(-0.437694+ALOGT*0.0179521)))
      DG(7,1)=EXP(-17.1913 + ALOGT*(4.85937
     1           +ALOGT*(-0.424058+ALOGT*0.018707)))
      DG(7,2)=EXP(-12.683 + ALOGT*(2.90343
     1           +ALOGT*(-0.170767+ALOGT*0.00777111)))
      DG(7,3)=EXP(-16.6121 + ALOGT*(3.93038
     1           +ALOGT*(-0.299431+ALOGT*0.0131429)))
      DG(7,4)=EXP(-14.782 + ALOGT*(3.37109
     1           +ALOGT*(-0.229857+ALOGT*0.0102585)))
      DG(7,5)=EXP(-20.3123 + ALOGT*(5.18631
     1           +ALOGT*(-0.431374+ALOGT*0.0175997)))
      DG(7,6)=EXP(-18.5094 + ALOGT*(4.54473
     1           +ALOGT*(-0.37305+ALOGT*0.0160822)))
      DG(7,7)=EXP(-15.514 + ALOGT*(3.47278
     1           +ALOGT*(-0.241643+ALOGT*0.010708)))
      DG(8,1)=EXP(-17.1872 + ALOGT*(4.60996
     1           +ALOGT*(-0.360588+ALOGT*0.0146263)))
      DG(8,2)=EXP(-15.2134 + ALOGT*(3.88532
     1           +ALOGT*(-0.298924+ALOGT*0.0133485)))
      DG(8,3)=EXP(-19.065 + ALOGT*(4.77759
     1           +ALOGT*(-0.397547+ALOGT*0.0169053)))
      DG(8,4)=EXP(-17.4129 + ALOGT*(4.34682
     1           +ALOGT*(-0.351535+ALOGT*0.0153205)))
      DG(8,5)=EXP(-20.1625 + ALOGT*(4.89987
     1           +ALOGT*(-0.368962+ALOGT*0.0139311)))
      DG(8,6)=EXP(-20.5023 + ALOGT*(5.1417
     1           +ALOGT*(-0.430311+ALOGT*0.017747)))
      DG(8,7)=EXP(-18.199 + ALOGT*(4.45809
     1           +ALOGT*(-0.363563+ALOGT*0.0157445)))
      DG(8,8)=EXP(-20.3335 + ALOGT*(5.12453
     1           +ALOGT*(-0.43143+ALOGT*0.0179293)))
      DG(9,1)=EXP(-17.3907 + ALOGT*(4.51749
     1           +ALOGT*(-0.339873+ALOGT*0.0133427)))
      DG(9,2)=EXP(-16.0962 + ALOGT*(4.14716
     1           +ALOGT*(-0.334766+ALOGT*0.0149811)))
      DG(9,3)=EXP(-19.3817 + ALOGT*(4.79946
     1           +ALOGT*(-0.398783+ALOGT*0.0168898)))
      DG(9,4)=EXP(-17.98 + ALOGT*(4.46288
     1           +ALOGT*(-0.366249+ALOGT*0.0159421)))
      DG(9,5)=EXP(-20.0217 + ALOGT*(4.70637
     1           +ALOGT*(-0.33983+ALOGT*0.0125128)))
      DG(9,6)=EXP(-20.7967 + ALOGT*(5.15316
     1           +ALOGT*(-0.430361+ALOGT*0.0176906)))
      DG(9,7)=EXP(-18.5911 + ALOGT*(4.51546
     1           +ALOGT*(-0.370645+ALOGT*0.0160361)))
      DG(9,8)=EXP(-20.5731 + ALOGT*(5.11029
     1           +ALOGT*(-0.427914+ALOGT*0.0177078)))
      DG(9,9)=EXP(-20.8688 + ALOGT*(5.13427
     1           +ALOGT*(-0.430394+ALOGT*0.0177929)))
      DG(10,1)=EXP(-15.3908 + ALOGT*(3.56501
     1           +ALOGT*(-0.186758+ALOGT*0.00553688)))
      DG(10,2)=EXP(-17.4777 + ALOGT*(4.67316
     1           +ALOGT*(-0.393511+ALOGT*0.0171139)))
      DG(10,3)=EXP(-20.4502 + ALOGT*(5.10864
     1           +ALOGT*(-0.419939+ALOGT*0.0170493)))
      DG(10,4)=EXP(-19.1499 + ALOGT*(4.8649
     1           +ALOGT*(-0.403922+ALOGT*0.0169726)))
      DG(10,5)=EXP(-17.5747 + ALOGT*(3.50944
     1           +ALOGT*(-0.14961+ALOGT*0.00296197)))
      DG(10,6)=EXP(-20.9109 + ALOGT*(5.02824
     1           +ALOGT*(-0.388423+ALOGT*0.0148782)))
      DG(10,7)=EXP(-20.0978 + ALOGT*(5.03718
     1           +ALOGT*(-0.424036+ALOGT*0.0177655)))
      DG(10,8)=EXP(-20.9499 + ALOGT*(5.10356
     1           +ALOGT*(-0.40282+ALOGT*0.0156791)))
      DG(10,9)=EXP(-21.1698 + ALOGT*(5.08253
     1           +ALOGT*(-0.39857+ALOGT*0.0154377)))
      DG(10,10)=EXP(-18.8726 + ALOGT*(3.92335
     1           +ALOGT*(-0.211587+ALOGT*0.00593929)))
      DG(11,1)=EXP(-17.2503 + ALOGT*(4.56692
     1           +ALOGT*(-0.350919+ALOGT*0.0140269)))
      DG(11,2)=EXP(-15.6474 + ALOGT*(4.02583
     1           +ALOGT*(-0.31812+ALOGT*0.0142214)))
      DG(11,3)=EXP(-19.2314 + ALOGT*(4.77165
     1           +ALOGT*(-0.394497+ALOGT*0.0166728)))
      DG(11,4)=EXP(-17.9367 + ALOGT*(4.48988
     1           +ALOGT*(-0.369756+ALOGT*0.0160925)))
      DG(11,5)=EXP(-19.2482 + ALOGT*(4.35673
     1           +ALOGT*(-0.283583+ALOGT*0.00964712)))
      DG(11,6)=EXP(-20.5839 + ALOGT*(5.09075
     1           +ALOGT*(-0.421526+ALOGT*0.0172747)))
      DG(11,7)=EXP(-18.5308 + ALOGT*(4.51696
     1           +ALOGT*(-0.370843+ALOGT*0.0160437)))
      DG(11,8)=EXP(-20.4108 + ALOGT*(5.06965
     1           +ALOGT*(-0.422158+ALOGT*0.0174363)))
      DG(11,9)=EXP(-20.7427 + ALOGT*(5.10186
     1           +ALOGT*(-0.425823+ALOGT*0.0175761)))
      DG(11,10)=EXP(-21.062 + ALOGT*(5.0662
     1           +ALOGT*(-0.396685+ALOGT*0.0153659)))
      DG(11,11)=EXP(-20.7468 + ALOGT*(5.12591
     1           +ALOGT*(-0.430004+ALOGT*0.0178019)))
      DG(12,1)=EXP(-15.0876 + ALOGT*(3.40014
     1           +ALOGT*(-0.164551+ALOGT*0.00451793)))
      DG(12,2)=EXP(-17.7017 + ALOGT*(4.74369
     1           +ALOGT*(-0.405899+ALOGT*0.0177865)))
      DG(12,3)=EXP(-20.0201 + ALOGT*(4.89518
     1           +ALOGT*(-0.39299+ALOGT*0.015899)))
      DG(12,4)=EXP(-19.0063 + ALOGT*(4.75441
     1           +ALOGT*(-0.3902+ALOGT*0.0163934)))
      DG(12,5)=EXP(-18.3581 + ALOGT*(3.82006
     1           +ALOGT*(-0.198708+ALOGT*0.00545853)))
      DG(12,6)=EXP(-21.0007 + ALOGT*(5.03586
     1           +ALOGT*(-0.393762+ALOGT*0.0152747)))
      DG(12,7)=EXP(-19.9644 + ALOGT*(4.93819
     1           +ALOGT*(-0.413543+ALOGT*0.0174021)))
      DG(12,8)=EXP(-20.9629 + ALOGT*(5.07382
     1           +ALOGT*(-0.402698+ALOGT*0.0158133)))
      DG(12,9)=EXP(-21.3314 + ALOGT*(5.12414
     1           +ALOGT*(-0.409012+ALOGT*0.0160836)))
      DG(12,10)=EXP(-19.7461 + ALOGT*(4.26355
     1           +ALOGT*(-0.26384+ALOGT*0.00851932)))
      DG(12,11)=EXP(-21.4149 + ALOGT*(5.18086
     1           +ALOGT*(-0.417814+ALOGT*0.0165235)))
      DG(12,12)=EXP(-20.5023 + ALOGT*(4.54905
     1           +ALOGT*(-0.308371+ALOGT*0.0107267)))
      DG(13,1)=EXP(-14.3486 + ALOGT*(2.97226
     1           +ALOGT*(-0.0982187+ALOGT*0.00119833)))
      DG(13,2)=EXP(-18.5644 + ALOGT*(5.0348
     1           +ALOGT*(-0.444264+ALOGT*0.0194728)))
      DG(13,3)=EXP(-20.173 + ALOGT*(4.87913
     1           +ALOGT*(-0.387427+ALOGT*0.0155184)))
      DG(13,4)=EXP(-19.1725 + ALOGT*(4.73622
     1           +ALOGT*(-0.38399+ALOGT*0.015961)))
      DG(13,5)=EXP(-18.1429 + ALOGT*(3.64682
     1           +ALOGT*(-0.172711+ALOGT*0.00422056)))
      DG(13,6)=EXP(-20.9247 + ALOGT*(4.92138
     1           +ALOGT*(-0.37462+ALOGT*0.0142786)))
      DG(13,7)=EXP(-20.1256 + ALOGT*(4.92776
     1           +ALOGT*(-0.409161+ALOGT*0.0170864)))
      DG(13,8)=EXP(-20.8962 + ALOGT*(4.96202
     1           +ALOGT*(-0.383911+ALOGT*0.0148311)))
      DG(13,9)=EXP(-21.3632 + ALOGT*(5.05998
     1           +ALOGT*(-0.39707+ALOGT*0.0154254)))
      DG(13,10)=EXP(-19.4744 + ALOGT*(4.069
     1           +ALOGT*(-0.234226+ALOGT*0.00707602)))
      DG(13,11)=EXP(-21.4823 + ALOGT*(5.12824
     1           +ALOGT*(-0.407546+ALOGT*0.0159443)))
      DG(13,12)=EXP(-20.3519 + ALOGT*(4.40515
     1           +ALOGT*(-0.285488+ALOGT*0.00957558)))
      DG(13,13)=EXP(-20.1583 + ALOGT*(4.24581
     1           +ALOGT*(-0.260534+ALOGT*0.00833144)))
      DG(14,1)=EXP(-15.5566 + ALOGT*(3.55482
     1           +ALOGT*(-0.188354+ALOGT*0.00565584)))
      DG(14,2)=EXP(-17.9534 + ALOGT*(4.83581
     1           +ALOGT*(-0.425235+ALOGT*0.0189442)))
      DG(14,3)=EXP(-19.6271 + ALOGT*(4.7062
     1           +ALOGT*(-0.372539+ALOGT*0.015157)))
      DG(14,4)=EXP(-19.1495 + ALOGT*(4.76915
     1           +ALOGT*(-0.397134+ALOGT*0.0168936)))
      DG(14,5)=EXP(-18.8384 + ALOGT*(4.00807
     1           +ALOGT*(-0.233165+ALOGT*0.00734348)))
      DG(14,6)=EXP(-20.5466 + ALOGT*(4.82186
     1           +ALOGT*(-0.371088+ALOGT*0.0144686)))
      DG(14,7)=EXP(-19.6707 + ALOGT*(4.77065
     1           +ALOGT*(-0.395791+ALOGT*0.016784)))
      DG(14,8)=EXP(-20.4581 + ALOGT*(4.82858
     1           +ALOGT*(-0.374937+ALOGT*0.0147423)))
      DG(14,9)=EXP(-21.0604 + ALOGT*(4.99335
     1           +ALOGT*(-0.398556+ALOGT*0.0158686)))
      DG(14,10)=EXP(-20.4773 + ALOGT*(4.56454
     1           +ALOGT*(-0.315268+ALOGT*0.0112269)))
      DG(14,11)=EXP(-21.2934 + ALOGT*(5.10127
     1           +ALOGT*(-0.415107+ALOGT*0.0166923)))
      DG(14,12)=EXP(-21.1681 + ALOGT*(4.8157
     1           +ALOGT*(-0.355083+ALOGT*0.0132117)))
      DG(14,13)=EXP(-21.3444 + ALOGT*(4.8164
     1           +ALOGT*(-0.352915+ALOGT*0.0130365)))
      DG(14,14)=EXP(-22.0185 + ALOGT*(5.15861
     1           +ALOGT*(-0.413914+ALOGT*0.0163138)))
C
      DO I=1,14
        DO J=I+1,14
          DG(I, J) = DG(J, I)
        ENDDO
      ENDDO
C
      DO I=1,14
        QG(I) = 0.D0
        DO J=1,14
          QG(I) = QG(I) + XG(J)/DG(I,J)
        ENDDO
      ENDDO
C
      D(  1) = (1.D0-Y(1))/(QG(1)-X(1)/DG(1,1))/PA
      D(  2) = (1.D0-Y(2))/(QG(2)-X(2)/DG(2,2))/PA
      D(  3) = (1.D0-Y(3))/(QG(3)-X(3)/DG(3,3))/PA
      D(  4) = (1.D0-Y(4))/(QG(4)-X(4)/DG(4,4))/PA
      D(  5) = (1.D0-Y(5))/(QG(3)-X(5)/DG(3,3))/PA
      D(  6) = (1.D0-Y(6))/(QG(4)-X(6)/DG(4,4))/PA
      D(  7) = (1.D0-Y(7))/(QG(5)-X(7)/DG(5,5))/PA
      D(  8) = (1.D0-Y(8))/(QG(6)-X(8)/DG(6,6))/PA
      D(  9) = (1.D0-Y(9))/(QG(7)-X(9)/DG(7,7))/PA
      D( 10) = (1.D0-Y(10))/(QG(8)-X(10)/DG(8,8))/PA
      D( 11) = (1.D0-Y(11))/(QG(9)-X(11)/DG(9,9))/PA
      D( 12) = (1.D0-Y(12))/(QG(10)-X(12)/DG(10,10))/PA
      D( 13) = (1.D0-Y(13))/(QG(9)-X(13)/DG(9,9))/PA
      D( 14) = (1.D0-Y(14))/(QG(10)-X(14)/DG(10,10))/PA
      D( 15) = (1.D0-Y(15))/(QG(7)-X(15)/DG(7,7))/PA
      D( 16) = (1.D0-Y(16))/(QG(7)-X(16)/DG(7,7))/PA
      D( 17) = (1.D0-Y(17))/(QG(7)-X(17)/DG(7,7))/PA
      D( 18) = (1.D0-Y(18))/(QG(11)-X(18)/DG(11,11))/PA
      D( 19) = (1.D0-Y(19))/(QG(12)-X(19)/DG(12,12))/PA
      D( 20) = (1.D0-Y(20))/(QG(13)-X(20)/DG(13,13))/PA
      D( 21) = (1.D0-Y(21))/(QG(13)-X(21)/DG(13,13))/PA
      D( 22) = (1.D0-Y(22))/(QG(14)-X(22)/DG(14,14))/PA
      D( 23) = (1.D0-Y(23))/(QG(14)-X(23)/DG(14,14))/PA
      D( 24) = (1.D0-Y(24))/(QG(14)-X(24)/DG(14,14))/PA
      D( 25) = (1.D0-Y(25))/(QG(14)-X(25)/DG(14,14))/PA
      D( 26) = (1.D0-Y(26))/(QG(14)-X(26)/DG(14,14))/PA
      D( 27) = (1.D0-Y(27))/(QG(14)-X(27)/DG(14,14))/PA
      D( 28) = (1.D0-Y(28))/(QG(14)-X(28)/DG(14,14))/PA
      D( 29) = (1.D0-Y(29))/(QG(14)-X(29)/DG(14,14))/PA
      D( 30) = (1.D0-Y(30))/(QG(7)-X(30)/DG(7,7))/PA
C
      RETURN
      END
